|
|
|
| Table 6.5 Optional Properties That Provide Further Control over Toolbar Buttons | | Property | Description | | Caption | This text is displayed beneath the picture on a button. | | Description | This text describes the button to the users when they invoke the Customize Toolbar dialog box. | | ToolTipText | This text appears when the mouse pointer rests on the button. This text is displayed only if the ShowTips property of the toolbar is set to True (which is the default). | | Value | This property sets or returns the current state of the button. A value of 0 indicates that the button is not pressed. A value of 1 indicates that the button is pressed. This property is typically used to pre-select a check-style button, or one button in a group. |
|
|
| |
|
|
|
|
Unless the images on your buttons are self-explanatory, you should include ToolTips. A ToolTip is a text message describing a button that appears when the users move the mouse pointer over the button. Depending on your application, you may be able to include ToolTips instead of captions to save some screen real estate. Without some text indication the users cannot know what the button does unless they click it. ToolTips give your program a professional appearance and are easy to add. |
|
|
|
|
|
|
|
|
|
|
After setting up the buttons on the toolbar, you can exit the Property Pages dialog box by clicking the OK button. |
|
|
|
|
|
|
|
|
Adding a Drop-Down Toolbar Button |
|
|
|
|
|
|
|
|
A new feature in Visual Basic 6 is the tbrDropDown style button. This button combines a normal toolbar button with a drop-down menu for an effect that is similar to a combo box. The following example illustrates how to create such a button and program its events. |
|
|
|
|
|
|
|
|
Starting a Toolbar Example |
|
|
|
|
|
|
|
|
To illustrate the use of toolbars, this section walks you through the creation of a sample program containing a standard toolbar button and a drop-down toolbar button, with a separator button providing blank space between them. Follow these steps: |
|
|
|
|
|
|
|
|
1. Create a new Standard EXE project. Add a ToolBar control and an ImageList control to the form as described in the preceding sections. |
|
|
|
|
|
|
|
|
2. Set the toolbar's Name property to tbrDemo. Leave the ImageList control's Name property set to the default of ImageList1. |
|
|
|
|
|
|
|
|
3. On the Images tab of the Property Pages dialog box for ImageList1, add two appropriate icons to the ImageList control (click the Insert Picture button and browse to the picture files). These icons will eventually be the pictures displayed on two toolbar buttons. |
|
|
|
|
|